using System;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using MetroCalendar.Models;

namespace MetroCalendar.Converters
{
    public class CalendarDayTypeBackgroundConverter : IValueConverter
    {
        #region IValueConverter Members
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            SolidColorBrush brush = null;

            switch ((DayType)value)
            {
                case DayType.NotCurrentMonth:
                    brush = new SolidColorBrush(Colors.White);
                    break;
                case DayType.SelectedDay:
                    brush = new SolidColorBrush(Color.FromArgb(255, 99, 101, 99));
                    break;
                case DayType.Today:
                    brush = new SolidColorBrush(Color.FromArgb(255, 24, 85, 33));
                    break;
                case DayType.LegalHoliday:
                    brush = new SolidColorBrush(Colors.Magenta);
                    break;
                case DayType.Weekend:
                    brush = new SolidColorBrush(Color.FromArgb(255, 247, 207, 24));
                    break;
                case DayType.CurrentMonth:
                    brush = new SolidColorBrush(Color.FromArgb(255, 148, 0, 0));
                    break;
                default:
                    break;
            }

            return brush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return DependencyProperty.UnsetValue;
        }

        #endregion
    }
}
